package com.lucky.common.config;

import com.lucky.common.util.AppUtil;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.Arrays;
import java.util.stream.Stream;

@Configuration
public class AppConfig {

	@Bean("util")
	public AppUtil util() {
		return new AppUtil();
	}



	private static final String[] testUrls = {
			"/demo/**",
			"/demo2/**"
	};
	private static final String[] excludeUrls = {

			"/index",
			"/captcha",
			"/login/**"
	};
	private static final String[] staticUrls = {
			"/base/**",
			"/common/**",
			"/vendors/**",
			"/css/**",
			"/js/**",
			"/images/**",
			"/error/**",

			"/**/*.html", "/**/*.js", "/**/*.css", "/**/*.map", "/**/*.json", "/**/*.pdf",//静态文件
			"/**/*.png", "/**/*.gif", "/**/*.svg", "/**/*.ico", "/**/*.mp4", //图片文件
			"/**/*.eot", "/**/*.ttf", "/**/*.woff", "/**/*.woff2"
	};
	public static String[] ignoreUrls =
			Stream.of(excludeUrls, staticUrls, testUrls)
				.flatMap(Arrays::stream)
				.toArray(String[]::new);

}
